﻿using DevFramework.IBll;
using DevFramework.Model;
using DevFramework.Unity;
using System;
using System.Collections.Generic;

namespace DevFramework.Test
{
    class Program
    {
        static void Main(string[] args)
        {

            /*
             *datamodel模型测试 
             */
            //测试Idal与Dal的依赖注入
            //Dictionary<string, object> dic = new Dictionary<string, object>();
            //dic.Add("assemblyName", "DevFramework.Model");
            //dic.Add("nameSpace", "DevFramework.Model");
            //dic.Add("contextName", "DataModelContainer");
            //var dao = UnityIocHelper.GetInstanceDAL<IDataDictionary_DetailDal>(dic);
            //dao.Add(new DataDictionary_Detail());

            //测试UI与Bll的依赖注入
            //var bll = UnityIocHelper.GetInstanceDAL<IDataDictionary_DetailService>(dic);
            //bll.Add(new DataDictionary_Detail() { Id = Guid.NewGuid(), IsDel = false, IsEnable = true, CreatePerson = "蔡依林", CreateTime = DateTime.Now, DataCode = "msms001", DisplayName = "男", LastUpdatePerson = "蔡依林", LastUpdateTime = DateTime.Now });
            //Console.ReadKey();

            /*
             *personmodel模型测试 
             */
            Dictionary<string, object> dic1 = new Dictionary<string, object>();
            dic1.Add("assemblyName", "DevFramework.Model");
            dic1.Add("nameSpace", "DevFramework.Model");
            dic1.Add("contextName", "PersonModelContainer");
            //测试UI与Bll的依赖注入
            var bll1 = UnityIocHelper.GetInstanceDAL<Person_IService>(dic1);
            bll1.Add(new Person() { Id = Guid.NewGuid(), Name = "出门" });

            /*
             * 测试splashForm
             */
            //Console.ReadKey();
            //ThreadWaitOrSplash.StartSplashThread();
            //Thread.Sleep(80000);
            //ThreadWaitOrSplash.StopSplashThread();
            //Console.ReadKey();


            //string filePath = @"C:\Users\Administrator\Source\Repos\DevFramework\DevFramework";
            ////命名空间
            //List<string> nameSpaces = new List<string>() { "DevFramework.IDal", "DevFramework.Dal", "DevFramework.Bll", "DevFramework.IBll" };
            ////程序集名称
            //List<string> assemblys = nameSpaces;
            ////定義別名
            //Dictionary<string, string> aliases = new Dictionary<string, string>();
            //foreach (var item in nameSpaces)
            //{
            //    string projectpath = filePath + "\\" + item;
            //    FileInfo[] files = new DirectoryInfo(projectpath).GetFiles();
            //    foreach (var file in files)
            //    {
            //        if (file.Name.Contains("_"))
            //            aliases.Add(file.Name.Split('.')[0], item + "." + file.Name.Split('.')[0] + "," + item);
            //    }
            //}
            ////定義映射
            //Dictionary<string, string> registers = new Dictionary<string, string>();
            //foreach (var type in aliases)
            //{
            //    if (type.Key.Contains("_I"))
            //    {
            //        string typehead = type.Key.Substring(0, type.Key.LastIndexOf("_I"));
            //        string typeend = type.Key.Substring(type.Key.LastIndexOf("_I")+2);
            //        foreach (var mapto in aliases)
            //        {
            //            string maptohead = mapto.Key.Substring(0, mapto.Key.LastIndexOf("_"));
            //            string maptoend = mapto.Key.Substring( mapto.Key.LastIndexOf("_")+1);

            //            if (typehead == maptohead && typeend == maptoend)
            //            {
            //                registers.Add(type.Key, mapto.Key);
            //                break;
            //            }
                            
            //        }
            //    }
            //}
            Console.ReadKey();
        }
    }
}
